var restify = require('restify');

var client = restify.createClient({
	url: 'http://www.baidu.com'
});

client.get('/str/mcavage', function(err, req) {
	assert.ifError(err);

	req.on('result', function(err, res) {
		assert.ifError(err);

		res.body = '';
		res.setEncoding('utf8');
		res.on('data', function(chunk) {
			res.body += chunk;
		});

		res.on('end'.function(){
			console.log(body);
		});

	});

	req.write('hello world');
	req.end();
});